home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #14 / Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO / prog_bas / msgbxcls.zip / MSGBXTST.FRM < prev    next >
Text File  |  1996-01-06  |  24KB  |  769 lines

  1. VERSION 4.00
  2. Begin VB.Form frmMsgBoxTest 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "MsgBox Class Test Project"
  5.    ClientHeight    =   6150
  6.    ClientLeft      =   1140
  7.    ClientTop       =   1560
  8.    ClientWidth     =   6765
  9.    Height          =   6585
  10.    Icon            =   "MSGBXTST.frx":0000
  11.    Left            =   1065
  12.    MaxButton       =   0   'False
  13.    ScaleHeight     =   410
  14.    ScaleMode       =   3  'Pixel
  15.    ScaleWidth      =   451
  16.    ShowInTaskbar   =   0   'False
  17.    Top             =   1200
  18.    Width           =   6915
  19.    Begin VB.TextBox txtObjectName 
  20.       Height          =   285
  21.       Left            =   5520
  22.       TabIndex        =   33
  23.       Text            =   "MB"
  24.       Top             =   3930
  25.       Width           =   1005
  26.    End
  27.    Begin VB.TextBox txtGeneratedCode 
  28.       Height          =   915
  29.       Left            =   270
  30.       MultiLine       =   -1  'True
  31.       ScrollBars      =   2  'Vertical
  32.       TabIndex        =   35
  33.       Top             =   4860
  34.       Width           =   6285
  35.    End
  36.    Begin VB.Frame fmeCallFormat 
  37.       Caption         =   "Call Format"
  38.       Height          =   885
  39.       Left            =   240
  40.       TabIndex        =   26
  41.       Top             =   3810
  42.       Width           =   2415
  43.       Begin VB.OptionButton optCallFormat 
  44.          Caption         =   "Set Properties First"
  45.          Height          =   225
  46.          Index           =   0
  47.          Left            =   240
  48.          TabIndex        =   27
  49.          Top             =   240
  50.          Value           =   -1  'True
  51.          Width           =   1950
  52.       End
  53.       Begin VB.OptionButton optCallFormat 
  54.          Caption         =   "Use Values In-line"
  55.          Height          =   225
  56.          Index           =   1
  57.          Left            =   240
  58.          TabIndex        =   28
  59.          Top             =   510
  60.          Width           =   1950
  61.       End
  62.    End
  63.    Begin VB.Frame fmeCallType 
  64.       Caption         =   "Call Type"
  65.       Height          =   885
  66.       Left            =   2880
  67.       TabIndex        =   29
  68.       Top             =   3810
  69.       Width           =   1725
  70.       Begin VB.OptionButton optCallType 
  71.          Caption         =   "Sub"
  72.          Height          =   255
  73.          Index           =   0
  74.          Left            =   240
  75.          TabIndex        =   30
  76.          Top             =   240
  77.          Value           =   -1  'True
  78.          Width           =   1155
  79.       End
  80.       Begin VB.OptionButton optCallType 
  81.          Caption         =   "Function"
  82.          Height          =   255
  83.          Index           =   1
  84.          Left            =   240
  85.          TabIndex        =   31
  86.          Top             =   510
  87.          Width           =   1155
  88.       End
  89.    End
  90.    Begin VB.CommandButton cmdGenerateCall 
  91.       Caption         =   "&Generate Call"
  92.       Height          =   360
  93.       Left            =   4890
  94.       TabIndex        =   34
  95.       Top             =   4350
  96.       Width           =   1665
  97.    End
  98.    Begin VB.Frame fmeIcon 
  99.       Caption         =   "Icon"
  100.       Height          =   2205
  101.       Left            =   4890
  102.       TabIndex        =   18
  103.       Top             =   1230
  104.       Width           =   1665
  105.       Begin VB.OptionButton optIcon 
  106.          Caption         =   "In&formation"
  107.          Height          =   225
  108.          Index           =   4
  109.          Left            =   240
  110.          TabIndex        =   23
  111.          Top             =   1500
  112.          Width           =   1275
  113.       End
  114.       Begin VB.OptionButton optIcon 
  115.          Caption         =   "E&xclamation"
  116.          Height          =   225
  117.          Index           =   3
  118.          Left            =   240
  119.          TabIndex        =   22
  120.          Top             =   1200
  121.          Width           =   1275
  122.       End
  123.       Begin VB.OptionButton optIcon 
  124.          Caption         =   "&Question"
  125.          Height          =   225
  126.          Index           =   2
  127.          Left            =   240
  128.          TabIndex        =   21
  129.          Top             =   900
  130.          Width           =   1275
  131.       End
  132.       Begin VB.OptionButton optIcon 
  133.          Caption         =   "Cr&itical"
  134.          Height          =   225
  135.          Index           =   1
  136.          Left            =   240
  137.          TabIndex        =   20
  138.          Top             =   600
  139.          Width           =   1275
  140.       End
  141.       Begin VB.OptionButton optIcon 
  142.          Caption         =   "Non&e"
  143.          Height          =   225
  144.          Index           =   0
  145.          Left            =   240
  146.          TabIndex        =   19
  147.          Top             =   300
  148.          Value           =   -1  'True
  149.          Width           =   1275
  150.       End
  151.    End
  152.    Begin VB.Frame fmeModality 
  153.       Caption         =   "Modality"
  154.       Height          =   885
  155.       Left            =   2880
  156.       TabIndex        =   15
  157.       Top             =   2550
  158.       Width           =   1725
  159.       Begin VB.OptionButton optModality 
  160.          Caption         =   "&System"
  161.          Height          =   255
  162.          Index           =   1
  163.          Left            =   240
  164.          TabIndex        =   17
  165.          Top             =   510
  166.          Width           =   1155
  167.       End
  168.       Begin VB.OptionButton optModality 
  169.          Caption         =   "&Application"
  170.          Height          =   255
  171.          Index           =   0
  172.          Left            =   240
  173.          TabIndex        =   16
  174.          Top             =   240
  175.          Value           =   -1  'True
  176.          Width           =   1155
  177.       End
  178.    End
  179.    Begin VB.Frame fmeDefaultButton 
  180.       Caption         =   "Default Button"
  181.       Height          =   1275
  182.       Left            =   2880
  183.       TabIndex        =   11
  184.       Top             =   1230
  185.       Width           =   1725
  186.       Begin VB.OptionButton optDefaultButton 
  187.          Caption         =   "Button &3"
  188.          Height          =   255
  189.          Index           =   2
  190.          Left            =   240
  191.          TabIndex        =   14
  192.          Top             =   900
  193.          Width           =   1215
  194.       End
  195.       Begin VB.OptionButton optDefaultButton 
  196.          Caption         =   "Button &2"
  197.          Height          =   255
  198.          Index           =   1
  199.          Left            =   240
  200.          TabIndex        =   13
  201.          Top             =   600
  202.          Width           =   1215
  203.       End
  204.       Begin VB.OptionButton optDefaultButton 
  205.          Caption         =   "Button &1"
  206.          Height          =   255
  207.          Index           =   0
  208.          Left            =   240
  209.          TabIndex        =   12
  210.          Top             =   300
  211.          Value           =   -1  'True
  212.          Width           =   1215
  213.       End
  214.    End
  215.    Begin VB.CommandButton cmdTestMsgBox 
  216.       Caption         =   "Test Message Box"
  217.       Height          =   360
  218.       Left            =   4890
  219.       TabIndex        =   24
  220.       Top             =   255
  221.       Width           =   1665
  222.    End
  223.    Begin VB.CommandButton cmdClose 
  224.       Caption         =   "Close"
  225.       Height          =   360
  226.       Left            =   4890
  227.       TabIndex        =   25
  228.       Top             =   705
  229.       Width           =   1665
  230.    End
  231.    Begin VB.Frame fmeButtons 
  232.       Caption         =   "Buttons"
  233.       Height          =   2205
  234.       Left            =   210
  235.       TabIndex        =   4
  236.       Top             =   1230
  237.       Width           =   2415
  238.       Begin VB.OptionButton optButtons 
  239.          Caption         =   "&Retry + Cancel"
  240.          Height          =   225
  241.          Index           =   5
  242.          Left            =   240
  243.          TabIndex        =   10
  244.          Top             =   1800
  245.          Width           =   1950
  246.       End
  247.       Begin VB.OptionButton optButtons 
  248.          Caption         =   "Yes + &No"
  249.          Height          =   225
  250.          Index           =   4
  251.          Left            =   240
  252.          TabIndex        =   9
  253.          Top             =   1500
  254.          Width           =   1950
  255.       End
  256.       Begin VB.OptionButton optButtons 
  257.          Caption         =   "&Yes + No + Cancel"
  258.          Height          =   225
  259.          Index           =   3
  260.          Left            =   240
  261.          TabIndex        =   8
  262.          Top             =   1200
  263.          Width           =   1950
  264.       End
  265.       Begin VB.OptionButton optButtons 
  266.          Caption         =   "A&bort + Retry +Ignore"
  267.          Height          =   225
  268.          Index           =   2
  269.          Left            =   240
  270.          TabIndex        =   7
  271.          Top             =   900
  272.          Width           =   1950
  273.       End
  274.       Begin VB.OptionButton optButtons 
  275.          Caption         =   "OK + &Cancel"
  276.          Height          =   225
  277.          Index           =   1
  278.          Left            =   240
  279.          TabIndex        =   6
  280.          Top             =   600
  281.          Width           =   1950
  282.       End
  283.       Begin VB.OptionButton optButtons 
  284.          Caption         =   "&OK only"
  285.          Height          =   225
  286.          Index           =   0
  287.          Left            =   240
  288.          TabIndex        =   5
  289.          Top             =   300
  290.          Value           =   -1  'True
  291.          Width           =   1950
  292.       End
  293.    End
  294.    Begin VB.TextBox txtTitle 
  295.       Height          =   285
  296.       Left            =   1320
  297.       TabIndex        =   1
  298.       Text            =   "Test Title"
  299.       Top             =   330
  300.       Width           =   1425
  301.    End
  302.    Begin VB.TextBox txtMessage 
  303.       Height          =   285
  304.       Left            =   1320
  305.       TabIndex        =   3
  306.       Text            =   "Test Message"
  307.       Top             =   750
  308.       Width           =   3285
  309.    End
  310.    Begin VB.Label lblObject 
  311.       BackStyle       =   0  'Transparent
  312.       Caption         =   "Object:"
  313.       Height          =   255
  314.       Left            =   4920
  315.       TabIndex        =   32
  316.       Top             =   3990
  317.       Width           =   495
  318.    End
  319.    Begin VB.Line linHorzSep 
  320.       BorderColor     =   &H00808080&
  321.       Index           =   1
  322.       X1              =   14
  323.       X2              =   436
  324.       Y1              =   246
  325.       Y2              =   246
  326.    End
  327.    Begin VB.Line linHorzSep 
  328.       BorderColor     =   &H00FFFFFF&
  329.       Index           =   0
  330.       X1              =   14
  331.       X2              =   436
  332.       Y1              =   244
  333.       Y2              =   244
  334.    End
  335.    Begin VB.Label lblStatusBar 
  336.       AutoSize        =   -1  'True
  337.       BackStyle       =   0  'Transparent
  338.       Caption         =   "Copyright ⌐ 1995-1996 Gregg Irwin.  All Rights Reserved."
  339.       BeginProperty Font 
  340.          name            =   "MS Sans Serif"
  341.          charset         =   1
  342.          weight          =   400
  343.          size            =   9.75
  344.          underline       =   0   'False
  345.          italic          =   0   'False
  346.          strikethrough   =   0   'False
  347.       EndProperty
  348.       Height          =   240
  349.       Left            =   240
  350.       TabIndex        =   36
  351.       Top             =   5850
  352.       Width           =   4980
  353.    End
  354.    Begin VB.Label lblTitle 
  355.       BackStyle       =   0  'Transparent
  356.       Caption         =   "&Title:"
  357.       Height          =   225
  358.       Left            =   270
  359.       TabIndex        =   0
  360.       Top             =   360
  361.       Width           =   885
  362.    End
  363.    Begin VB.Label lblMessage 
  364.       BackStyle       =   0  'Transparent
  365.       Caption         =   "&Message:"
  366.       Height          =   225
  367.       Left            =   270
  368.       TabIndex        =   2
  369.       Top             =   780
  370.       Width           =   885
  371.    End
  372. End
  373. Attribute VB_Name = "frmMsgBoxTest"
  374. Attribute VB_Creatable = False
  375. Attribute VB_Exposed = False
  376. '
  377. ' MsgBox Class Test Project
  378. ' Copyright ⌐ 1995-1996 Gregg Irwin. All Rights Reserved.
  379. '
  380. Option Explicit
  381. DefInt A-Z
  382.  
  383. Const STYLE_OP_BUTTON = 0
  384. Const STYLE_OP_DEF_BUTTON = 1
  385. Const STYLE_OP_MODALITY = 2
  386. Const STYLE_OP_ICON = 3
  387.  
  388. Const OPT_BTN_OK_ONLY = 0
  389. Const OPT_BTN_OK_CANCEL = 1
  390. Const OPT_BTN_ABORT_RETRY_IGNORE = 2
  391. Const OPT_BTN_YES_NO_CANCEL = 3
  392. Const OPT_BTN_YES_NO = 4
  393. Const OPT_BTN_RETRY_CANCEL = 5
  394.  
  395. Const OPT_DEF_BTN_1 = 0
  396. Const OPT_DEF_BTN_2 = 1
  397. Const OPT_DEF_BTN_3 = 2
  398. Const OPT_DEF_BTN_4 = 3
  399.  
  400. Const OPT_ICON_NONE = 0
  401. Const OPT_ICON_CRITICAL = 1
  402. Const OPT_ICON_QUESTION = 2
  403. Const OPT_ICON_EXCLAMATION = 3
  404. Const OPT_ICON_INFORMATION = 4
  405.  
  406. Const OPT_MODALITY_APP = 0
  407. Const OPT_MODALITY_SYSTEM = 1
  408.  
  409. Const CALL_TYPE_SUB = 0
  410. Const CALL_TYPE_FUNCTION = 1
  411.  
  412. Const CALL_FORMAT_SET_PROPS_FIRST = 0
  413. Const CALL_FORMAT_USE_VALS_INLINE = 1
  414.  
  415. Const DEF_OBJECT_NAME = "MB"
  416.  
  417. Private mStyleOp(3) As Long         '-- selected Style options
  418.  
  419. '=======================================================
  420. '== EVENTS
  421. '=======================================================
  422.  
  423. Private Sub cmdClose_Click()
  424.     
  425.     Unload Me
  426.  
  427. End Sub
  428.  
  429. Private Sub cmdGenerateCall_Click()
  430.     Dim ObjName As String
  431.     Dim GenCode As String
  432.     
  433.     ObjName = txtObjectName.Text
  434.     If ObjName = "" Then
  435.         ObjName = DEF_OBJECT_NAME
  436.     End If
  437.     
  438.     GenCode = ""
  439.     GenCode = GenCode & "Dim " & ObjName & " As New clsMsgBox" & vbCrLf
  440.     GenCode = GenCode & "Dim " & ObjName & "Rtn As Integer" & vbCrLf
  441.     GenCode = GenCode & vbCrLf
  442.     
  443.     Select Case GetCallFormat()
  444.         Case CALL_FORMAT_SET_PROPS_FIRST
  445.             GenCode = GenCode & "With " & ObjName & vbCrLf
  446.             GenCode = GenCode & "    .Title = " & Chr$(34) & txtTitle.Text & Chr$(34) & vbCrLf
  447.             GenCode = GenCode & "    .Message = " & Chr$(34) & txtMessage.Text & Chr$(34) & vbCrLf
  448.             GenCode = GenCode & "    .Style = " & GenerateStyleCode() & vbCrLf
  449.             GenCode = GenCode & "End With" & vbCrLf
  450.             Select Case GetCallType()
  451.                 Case CALL_TYPE_SUB
  452.                     GenCode = GenCode & ObjName & ".ShowModal" & vbCrLf
  453.                 Case CALL_TYPE_FUNCTION
  454.                     GenCode = GenCode & ObjName & "Rtn = " & ObjName & ".ShowModal" & vbCrLf
  455.                     GenCode = GenCode & GenerateRtnCodeHandler(ObjName) & vbCrLf
  456.                 Case Else
  457.             End Select
  458.         Case CALL_FORMAT_USE_VALS_INLINE
  459.             Select Case GetCallType()
  460.                 Case CALL_TYPE_SUB
  461.                     GenCode = GenCode & ObjName & ".ShowModal "
  462.                     GenCode = GenCode & " StyleFlags := (" & GenerateStyleCode() & "),"
  463.                     GenCode = GenCode & " Msg := " & Chr$(34) & txtMessage.Text & Chr$(34) & ", "
  464.                     GenCode = GenCode & " BoxTitle := " & Chr$(34) & txtTitle.Text & Chr$(34)
  465.                     GenCode = GenCode & vbCrLf
  466.                 Case CALL_TYPE_FUNCTION
  467.                     GenCode = GenCode & ObjName & "Rtn = " & ObjName & ".ShowModal ("
  468.                     GenCode = GenCode & " StyleFlags := (" & GenerateStyleCode() & "),"
  469.                     GenCode = GenCode & " Msg := " & Chr$(34) & txtMessage.Text & Chr$(34) & ", "
  470.                     GenCode = GenCode & " BoxTitle := " & Chr$(34) & txtTitle.Text & Chr$(34) & ")"
  471.                     GenCode = GenCode & vbCrLf
  472.                     GenCode = GenCode & GenerateRtnCodeHandler(ObjName) & vbCrLf
  473.                 Case Else
  474.             End Select
  475.         Case Else
  476.     End Select
  477.     
  478.     txtGeneratedCode = GenCode
  479.         
  480. End Sub
  481.  
  482. Private Sub cmdTestMsgBox_Click()
  483.     Dim MB      As New clsMsgBox
  484.     Dim Style   As Long
  485.     Dim i       As Integer
  486.     Dim Cap     As String
  487.     Dim Msg     As String
  488.     Dim MBRtn   As Integer  '-- MsgBox Return Value
  489.     
  490.     '-- Accumulate all the selected style settings
  491.     For i = LBound(mStyleOp) To UBound(mStyleOp)
  492.         Style = Style + mStyleOp(i)
  493.     Next i
  494.     
  495.     '-- Set message and title
  496.     Msg = txtMessage.Text
  497.     Cap = txtTitle.Text
  498.     
  499.     '-- Display the message box
  500.     MBRtn = MB.ShowModal(Msg, Style, Cap, (Me.HWnd))
  501.  
  502.     '-- Display the return value
  503.     lblStatusBar.Caption = MsgBoxReturnCodeDesc(MBRtn) & " was selected"
  504.     
  505. End Sub
  506.  
  507. Private Sub Form_Load()
  508.  
  509.     '-- Center the form on the screen
  510.     Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
  511.     
  512. End Sub
  513.  
  514. Private Sub optButtons_Click(Index As Integer)
  515.  
  516.     '-- The control array index values just happen
  517.     '   to match the values we need.
  518.     mStyleOp(STYLE_OP_BUTTON) = Index
  519.     
  520.     Select Case Index
  521.         Case OPT_BTN_OK_ONLY
  522.             Call SetCallType(CALL_TYPE_SUB)
  523.         Case Else
  524.             Call SetCallType(CALL_TYPE_FUNCTION)
  525.     End Select
  526.     
  527. End Sub
  528.  
  529. Private Sub optDefaultButton_Click(Index As Integer)
  530.     
  531.     '-- The control array index values just happen
  532.     '   to match the values we need (when multiplied
  533.     '   by 256).
  534.     mStyleOp(STYLE_OP_DEF_BUTTON) = Index * 256
  535.  
  536. End Sub
  537.  
  538. Private Sub optIcon_Click(Index As Integer)
  539.  
  540.     '-- The control array index values just happen
  541.     '   to match the values we need (when multiplied
  542.     '   by 16).
  543.     mStyleOp(STYLE_OP_ICON) = Index * 16
  544.  
  545. End Sub
  546.  
  547. Private Sub optModality_Click(Index As Integer)
  548.  
  549.     '-- The control array index values just happen
  550.     '   to match the values we need (when multiplied
  551.     '   by 4096).
  552.     mStyleOp(STYLE_OP_MODALITY) = Index * 4096
  553.  
  554. End Sub
  555.  
  556. '=======================================================
  557. '== INTERNAL SUPPORT PROCEDURES
  558. '=======================================================
  559.  
  560. ' MsgBoxReturnCodeDesc()
  561. Private Function MsgBoxReturnCodeDesc(MsgBoxRtnCode As Integer) As String
  562.     Dim Desc As String
  563.     
  564.     Select Case MsgBoxRtnCode
  565.         Case vbAbort
  566.             Desc = "Abort"
  567.         Case vbCancel
  568.             Desc = "Cancel"
  569.         Case vbIgnore
  570.             Desc = "Ignore"
  571.         Case vbNo
  572.             Desc = "No"
  573.         Case vbOK
  574.             Desc = "OK"
  575.         Case vbRetry
  576.             Desc = "Retry"
  577.         Case vbYes
  578.             Desc = "Yes"
  579.         Case Else
  580.             Desc = "Unknown (" & CStr(MsgBoxRtnCode) & ")"
  581.     End Select
  582.  
  583.     MsgBoxReturnCodeDesc = Desc
  584.     
  585. End Function
  586.  
  587. ' SetCallType
  588. Private Sub SetCallType(CallType As Integer)
  589.  
  590.     Select Case CallType
  591.         Case CALL_TYPE_SUB
  592.             optCallType(0).Value = True
  593.         Case CALL_TYPE_FUNCTION
  594.             optCallType(1).Value = True
  595.         Case Else
  596.     End Select
  597.     
  598. End Sub
  599.  
  600. ' GetCallType()
  601. Private Function GetCallType() As Integer
  602.     
  603.     If optCallType(0).Value = True Then
  604.         GetCallType = CALL_TYPE_SUB
  605.     Else
  606.         GetCallType = CALL_TYPE_FUNCTION
  607.     End If
  608.     
  609. End Function
  610.  
  611. ' GetCallFormat()
  612. Private Function GetCallFormat() As Integer
  613.     
  614.     If optCallFormat(0).Value = True Then
  615.         GetCallFormat = CALL_FORMAT_SET_PROPS_FIRST
  616.     Else
  617.         GetCallFormat = CALL_FORMAT_USE_VALS_INLINE
  618.     End If
  619.     
  620. End Function
  621.  
  622.  
  623. ' GetButtonStyleOption()
  624. Private Function GetButtonStyleOption() As Integer
  625.  
  626.     GetButtonStyleOption = mStyleOp(STYLE_OP_BUTTON)
  627.     
  628. End Function
  629.  
  630. ' GetDefaultButtonStyleOption()
  631. Private Function GetDefaultButtonStyleOption() As Integer
  632.  
  633.     GetDefaultButtonStyleOption = mStyleOp(STYLE_OP_DEF_BUTTON) \ 256
  634.     
  635. End Function
  636.  
  637. ' GetIconStyleOption()
  638. Private Function GetIconStyleOption() As Integer
  639.  
  640.     GetIconStyleOption = mStyleOp(STYLE_OP_ICON) \ 16
  641.     
  642. End Function
  643.  
  644. ' GetModalityStyleOption()
  645. Private Function GetModalityStyleOption() As Integer
  646.  
  647.     GetModalityStyleOption = mStyleOp(STYLE_OP_MODALITY) \ 4096
  648.     
  649. End Function
  650.  
  651. ' GenerateStyleCode()
  652. Private Function GenerateStyleCode() As String
  653.     Dim BtnStyle    As String
  654.     Dim DefBtnStyle As String
  655.     Dim IconStyle   As String
  656.     Dim ModalStyle  As String
  657.     Dim GenStyle    As String
  658.     
  659.     Select Case GetButtonStyleOption()
  660.         Case OPT_BTN_OK_ONLY
  661.             BtnStyle = "vbOKOnly"
  662.         Case OPT_BTN_OK_CANCEL
  663.             BtnStyle = "vbOKCancel"
  664.         Case OPT_BTN_ABORT_RETRY_IGNORE
  665.             BtnStyle = "vbAbortRetryIgnore"
  666.         Case OPT_BTN_YES_NO_CANCEL
  667.             BtnStyle = "vbYesNoCancel"
  668.         Case OPT_BTN_YES_NO
  669.             BtnStyle = "vbYesNo"
  670.         Case OPT_BTN_RETRY_CANCEL
  671.             BtnStyle = "vbRetryCancel"
  672.         Case Else
  673.             BtnStyle = ""
  674.     End Select
  675.  
  676.     Select Case GetDefaultButtonStyleOption()
  677.         Case OPT_DEF_BTN_1
  678.             '-- Default value. No need to generate code
  679.             'DefBtnStyle = "vbDefaultButton1"
  680.         Case OPT_DEF_BTN_2
  681.             DefBtnStyle = "vbDefaultButton2"
  682.         Case OPT_DEF_BTN_3
  683.             DefBtnStyle = "vbDefaultButton3"
  684.         Case OPT_DEF_BTN_4
  685.             DefBtnStyle = "vbDefaultButton4"
  686.         Case Else
  687.             DefBtnStyle = ""
  688.     End Select
  689.     
  690.     Select Case GetIconStyleOption()
  691.         Case OPT_ICON_NONE
  692.             '-- Default value. No need to generate code
  693.             'IconStyle = ""
  694.         Case OPT_ICON_CRITICAL
  695.             IconStyle = "vbCritical"
  696.         Case OPT_ICON_QUESTION
  697.             IconStyle = "vbQuestion"
  698.         Case OPT_ICON_EXCLAMATION
  699.             IconStyle = "vbExclamation"
  700.         Case OPT_ICON_INFORMATION
  701.             IconStyle = "vbInformation"
  702.         Case Else
  703.             IconStyle = ""
  704.     End Select
  705.     
  706.     Select Case GetModalityStyleOption()
  707.         Case OPT_MODALITY_APP
  708.             '-- Default value. No need to generate code
  709.             'ModalStyle = "vbApplicationModal"
  710.         Case OPT_MODALITY_SYSTEM
  711.             ModalStyle = "vbSystemModal"
  712.         Case Else
  713.             ModalStyle = ""
  714.     End Select
  715.     
  716.     GenStyle = ""
  717.     If Len(BtnStyle) Then
  718.         GenStyle = GenStyle & BtnStyle
  719.     End If
  720.     If Len(DefBtnStyle) Then
  721.         GenStyle = GenStyle & " + " & DefBtnStyle
  722.     End If
  723.     If Len(IconStyle) Then
  724.         GenStyle = GenStyle & " + " & IconStyle
  725.     End If
  726.     If Len(ModalStyle) Then
  727.         GenStyle = GenStyle & " + " & ModalStyle
  728.     End If
  729.     
  730.     GenerateStyleCode = GenStyle
  731.     
  732. End Function
  733.  
  734. ' GenerateRtnCodeHandler()
  735. Private Function GenerateRtnCodeHandler(ObjName As String) As String
  736.     Dim GenHandler As String
  737.     
  738.     GenHandler = ""
  739.     GenHandler = "Select Case " & ObjName & "Rtn" & vbCrLf
  740.     Select Case GetButtonStyleOption()
  741.         Case OPT_BTN_OK_ONLY
  742.             GenHandler = GenHandler & "    Case vbOK" & vbCrLf
  743.         Case OPT_BTN_OK_CANCEL
  744.             GenHandler = GenHandler & "    Case vbOK" & vbCrLf
  745.             GenHandler = GenHandler & "    Case vbCancel" & vbCrLf
  746.         Case OPT_BTN_ABORT_RETRY_IGNORE
  747.             GenHandler = GenHandler & "    Case vbAbort" & vbCrLf
  748.             GenHandler = GenHandler & "    Case vbRetry" & vbCrLf
  749.             GenHandler = GenHandler & "    Case vbIgnore" & vbCrLf
  750.         Case OPT_BTN_YES_NO_CANCEL
  751.             GenHandler = GenHandler & "    Case vbYes" & vbCrLf
  752.             GenHandler = GenHandler & "    Case vbNo" & vbCrLf
  753.             GenHandler = GenHandler & "    Case vbCancel" & vbCrLf
  754.         Case OPT_BTN_YES_NO
  755.             GenHandler = GenHandler & "    Case vbYes" & vbCrLf
  756.             GenHandler = GenHandler & "    Case vbNo" & vbCrLf
  757.         Case OPT_BTN_RETRY_CANCEL
  758.             GenHandler = GenHandler & "    Case vbRetry" & vbCrLf
  759.             GenHandler = GenHandler & "    Case vbCancel" & vbCrLf
  760.         Case Else
  761.     End Select
  762.     GenHandler = GenHandler & "    Case Else" & vbCrLf
  763.     GenHandler = GenHandler & "End Select"
  764.  
  765.     GenerateRtnCodeHandler = GenHandler
  766.  
  767. End Function
  768.  
  769.